<script type="text/javascript">
function rely(message_id, floor) {
    $('#rely_message').val(message_id);
    if (message_id == '') {
        $('#rely_floor').html(floor);
    } else {
        $('#rely_floor').html(floor + '楼');
    }

    $('#content_mm').focus();
}
</script>
<div class="comment-list">
    <present name="message_list">
    <volist name='message_list' id='message'>
        <div class="comment-item">
            <a name="post{$message.id}" class="comment-target">
                <span class="placeholder"></span>
            </a>
            <div class="comment-avatar">
                <if condition="($message['portrait'] eq 0) OR ($message['portrait'] eq NULL)">
                    <img src="__PUBLIC__/img/no-avatar.jpg" alt="">
                    <else/>
                    <img src='{:showFileUrl($message["portrait"],"avatar")}' />
                </if>
            </div>
            <div class="comment-data">
                <div class="comment-content">
                    <div class="pull-left comment-author">{$message.nick_name}</div>
                    <div class="pull-right comment-date">
                        {$message.create_date|date="Y-m-d H:i:s",###}&nbsp;&nbsp;{$message.floor}楼
                        <present name="user">
                            <neq name="Think.session.auth_id" value="$message['uid']">
                                &nbsp;&nbsp;<a href="#reply" class='btn btn-mtx btn-xs btn-flat' title="回复" onclick="JavaScript:rely({$message.id}, {$message.floor});">
                                    <i class="fa fa-reply"></i> 回复
                                </a>
                            </neq>
                        </present>
                    </div>
                    <div class="clearfix"></div>
                    <div id="p{$message.id}" style="visibility:visible;">
                        <present name='message.rely_m_content'>
                            
                            <div class="comment-quote">
                                <div class="comment-quote-title">回复 <span class="comment-author">{$message.rely_m_nick_name}</span> 的评论</div>
                                <div class="comment-content"><eq name="message.rely_m_status" value="1">{$message.rely_m_content}<else/>评论已被删除</eq></div>
                            </div>
                        </present>
                        <div class="comment-content">
                            <eq name="message.status" value="1">{$message['content']}<else />评论已被删除</eq>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </volist>
    <else />
    <p class="empty-list"><i class="fa fa-info-circle"></i> 暂无留言</p>
    </present>
</div>
<nav class="text-center row">
    {:W('Common/TabPage/index', array($message_count, $per_page, $tab_page, $tab))}
</nav>
<div class="form-group reply-form">
    <present name="user">
        <form class="comment-form ajax-form" method="post" action="{:addons_url('Message://Message/comment')}">
            <input type="hidden" name="rely_id" value="{$rely_id}" />
            <input type="hidden" name="rely_key" value="{$rely_key}" />
            <input type="hidden" name="rely_message" id="rely_message" value="" />
            <span>回复 </span><span id="rely_floor"></span>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:rely('', '正文')">回复正文</a>
            <textarea required name="content" id="content_mm" class="form-control" rows="5"></textarea>
            <br/>
            <button type="submit" class="pure-button button-more">回复</button>
            <eq name='config.anon' value='1'>
            <input type="checkbox" name='anon' /> 匿名评论
            </eq>
        </form>
        <script type="text/javascript" src="/Public/libs/validate/jquery.validate.min.js"></script>
        <script>
        jQuery(document).ready(function($){
            $('.comment-form').validate({
                messages: {
                    content: '请填写评论内容'
                }
            });
        })
        </script>
        <else />
        <span>请登录发表评论&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <a href="{:U('/home/index/login')}" class="btn btn-sm btn-flat btn-mtx">登录</a> <a class="btn btn-sm btn-flat btn-mtx" href="{:U('/Home/Register')}">注册</a>
    </present>
</div>
